// 206.翻转链表
package LeetcodeHot100;

public class Solution206 {
    public ListNode reverseList(ListNode head) {
        ListNode pre = new ListNode(0);
        while (head != null) {
            ListNode index = head.next;
            head.next = pre.next;
            pre.next = head;
            head = index;
        }
        return pre.next;
    }
}
